Project Review – Programming a Forms Connect 4

By David Higgins

This project was a follow up to the Console Connect 4 game I had made previously. The general logic of the program can be found in my review for that project. The Forms Connect 4 task was to simply take the console based game we had made and make it visual using VB forms. I enjoyed this project since it made the entire game much nicer to play. This time I used buttons on the top of the form so users could decide which column they would like to drop their counters into. I attached an event handlers to the buttons so that when they are clicked, a counter appears in the lowest empty slot available. The form looks like this:



I also used input boxes to retrieve the player names and I used a message box to display the winner. A small display at the bottom also shows the users who has the next turn.

An additional challenge we had with this project was a clue feature. This would tell the user if a player was one turn away from winning. The users are shown an option at the beginning of the game to enable the feature.



I found this feature very difficult to implement and could not think of a good way to solve it. It would be too difficult to program every scenario where there are already three counters in a row and the fourth position is free. This is where I have to credit a friend who gave me a very clever solution. Without showing the user, place a counter one by one in each of the seven slots and then run the check for win algorithm. If it returns true, you know the player is one move away from winning unless their opposition can block it.